Optimal. Leaf size=320 \[ -\frac {(b c-a d) \left (A b^2-a (b B-a C)\right )}{2 b^2 f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}-\frac {a^4 C d-a^2 b^2 (d (A-3 C)+B c)+2 a b^3 (A c-B d-c C)+b^4 (A d+B c)}{b^2 f \left (a^2+b^2\right )^2 (a+b \tan (e+f x))}+\frac {\left (-\left (a^3 (d (A-C)+B c)\right )+3 a^2 b (A c-B d-c C)+3 a b^2 (d (A-C)+B c)-b^3 (A c-B d-c C)\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3}+\frac {x \left (a^3 (A c-B d-c C)+3 a^2 b (d (A-C)+B c)-3 a b^2 (A c-B d-c C)-b^3 (d (A-C)+B c)\right )}{\left (a^2+b^2\right )^3} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.70, antiderivative size = 320, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 4, integrand size = 43, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.093, Rules used = {3635, 3628, 3531, 3530} \[ -\frac {(b c-a d) \left (A b^2-a (b B-a C)\right )}{2 b^2 f \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}-\frac {-a^2 b^2 (d (A-3 C)+B c)+a^4 C d+2 a b^3 (A c-B d-c C)+b^4 (A d+B c)}{b^2 f \left (a^2+b^2\right )^2 (a+b \tan (e+f x))}+\frac {\left (3 a^2 b (A c-B d-c C)+a^3 (-(d (A-C)+B c))+3 a b^2 (d (A-C)+B c)-b^3 (A c-B d-c C)\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right )^3}+\frac {x \left (3 a^2 b (d (A-C)+B c)+a^3 (A c-B d-c C)-3 a b^2 (A c-B d-c C)-b^3 (d (A-C)+B c)\right )}{\left (a^2+b^2\right )^3} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3530
Rule 3531
Rule 3628
Rule 3635
Rubi steps
\begin {align*} \int \frac {(c+d \tan (e+f x)) \left (A+B \tan (e+f x)+C \tan ^2(e+f x)\right )}{(a+b \tan (e+f x))^3} \, dx &=-\frac {\left (A b^2-a (b B-a C)\right ) (b c-a d)}{2 b^2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}+\frac {\int \frac {a^2 C d+b^2 (B c+A d)+a b (A c-c C-B d)-b (A b c-a B c-b c C-a A d-b B d+a C d) \tan (e+f x)+\left (a^2+b^2\right ) C d \tan ^2(e+f x)}{(a+b \tan (e+f x))^2} \, dx}{b \left (a^2+b^2\right )}\\ &=-\frac {\left (A b^2-a (b B-a C)\right ) (b c-a d)}{2 b^2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {a^4 C d+b^4 (B c+A d)+2 a b^3 (A c-c C-B d)-a^2 b^2 (B c+(A-3 C) d)}{b^2 \left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}+\frac {\int \frac {b \left (a^2 (A c-c C-B d)-b^2 (A c-c C-B d)+2 a b (B c+(A-C) d)\right )-b \left (2 a b (A c-c C-B d)-a^2 (B c+(A-C) d)+b^2 (B c+(A-C) d)\right ) \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{b \left (a^2+b^2\right )^2}\\ &=\frac {\left (a^3 (A c-c C-B d)-3 a b^2 (A c-c C-B d)+3 a^2 b (B c+(A-C) d)-b^3 (B c+(A-C) d)\right ) x}{\left (a^2+b^2\right )^3}-\frac {\left (A b^2-a (b B-a C)\right ) (b c-a d)}{2 b^2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {a^4 C d+b^4 (B c+A d)+2 a b^3 (A c-c C-B d)-a^2 b^2 (B c+(A-3 C) d)}{b^2 \left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}+\frac {\left (3 a^2 b (A c-c C-B d)-b^3 (A c-c C-B d)-a^3 (B c+(A-C) d)+3 a b^2 (B c+(A-C) d)\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right )^3}\\ &=\frac {\left (a^3 (A c-c C-B d)-3 a b^2 (A c-c C-B d)+3 a^2 b (B c+(A-C) d)-b^3 (B c+(A-C) d)\right ) x}{\left (a^2+b^2\right )^3}+\frac {\left (3 a^2 b (A c-c C-B d)-b^3 (A c-c C-B d)-a^3 (B c+(A-C) d)+3 a b^2 (B c+(A-C) d)\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right )^3 f}-\frac {\left (A b^2-a (b B-a C)\right ) (b c-a d)}{2 b^2 \left (a^2+b^2\right ) f (a+b \tan (e+f x))^2}-\frac {a^4 C d+b^4 (B c+A d)+2 a b^3 (A c-c C-B d)-a^2 b^2 (B c+(A-3 C) d)}{b^2 \left (a^2+b^2\right )^2 f (a+b \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] time = 6.38, size = 379, normalized size = 1.18 \[ -\frac {C (c+d \tan (e+f x))}{b f (a+b \tan (e+f x))^2}-\frac {-\frac {-a C d-b B d+b c C}{2 b f (a+b \tan (e+f x))^2}+\frac {\frac {\left (2 a b^2 (d (A-C)+B c)-2 b^3 (A c-B d-c C)\right ) \left (-\frac {2 a b}{\left (a^2+b^2\right )^2 (a+b \tan (e+f x))}-\frac {b}{2 \left (a^2+b^2\right ) (a+b \tan (e+f x))^2}+\frac {b \left (3 a^2-b^2\right ) \log (a+b \tan (e+f x))}{\left (a^2+b^2\right )^3}-\frac {\log (-\tan (e+f x)+i)}{2 (-b+i a)^3}+\frac {\log (\tan (e+f x)+i)}{2 (b+i a)^3}\right )}{b}-2 b (d (A-C)+B c) \left (-\frac {b}{\left (a^2+b^2\right ) (a+b \tan (e+f x))}+\frac {2 a b \log (a+b \tan (e+f x))}{\left (a^2+b^2\right )^2}-\frac {i \log (-\tan (e+f x)+i)}{2 (a+i b)^2}+\frac {i \log (\tan (e+f x)+i)}{2 (a-i b)^2}\right )}{2 b f}}{b} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 2.06, size = 987, normalized size = 3.08 \[ \frac {2 \, {\left ({\left ({\left (A - C\right )} a^{5} + 3 \, B a^{4} b - 3 \, {\left (A - C\right )} a^{3} b^{2} - B a^{2} b^{3}\right )} c - {\left (B a^{5} - 3 \, {\left (A - C\right )} a^{4} b - 3 \, B a^{3} b^{2} + {\left (A - C\right )} a^{2} b^{3}\right )} d\right )} f x + {\left (2 \, {\left ({\left ({\left (A - C\right )} a^{3} b^{2} + 3 \, B a^{2} b^{3} - 3 \, {\left (A - C\right )} a b^{4} - B b^{5}\right )} c - {\left (B a^{3} b^{2} - 3 \, {\left (A - C\right )} a^{2} b^{3} - 3 \, B a b^{4} + {\left (A - C\right )} b^{5}\right )} d\right )} f x + {\left (C a^{4} b - 3 \, B a^{3} b^{2} + 5 \, {\left (A - C\right )} a^{2} b^{3} + 3 \, B a b^{4} - A b^{5}\right )} c + {\left (C a^{5} + B a^{4} b - {\left (3 \, A - 7 \, C\right )} a^{3} b^{2} - 5 \, B a^{2} b^{3} + 3 \, A a b^{4}\right )} d\right )} \tan \left (f x + e\right )^{2} - {\left (3 \, C a^{4} b - 5 \, B a^{3} b^{2} + {\left (7 \, A - 3 \, C\right )} a^{2} b^{3} + B a b^{4} + A b^{5}\right )} c + {\left (C a^{5} - 3 \, B a^{4} b + 5 \, {\left (A - C\right )} a^{3} b^{2} + 3 \, B a^{2} b^{3} - A a b^{4}\right )} d - {\left ({\left ({\left (B a^{3} b^{2} - 3 \, {\left (A - C\right )} a^{2} b^{3} - 3 \, B a b^{4} + {\left (A - C\right )} b^{5}\right )} c + {\left ({\left (A - C\right )} a^{3} b^{2} + 3 \, B a^{2} b^{3} - 3 \, {\left (A - C\right )} a b^{4} - B b^{5}\right )} d\right )} \tan \left (f x + e\right )^{2} + {\left (B a^{5} - 3 \, {\left (A - C\right )} a^{4} b - 3 \, B a^{3} b^{2} + {\left (A - C\right )} a^{2} b^{3}\right )} c + {\left ({\left (A - C\right )} a^{5} + 3 \, B a^{4} b - 3 \, {\left (A - C\right )} a^{3} b^{2} - B a^{2} b^{3}\right )} d + 2 \, {\left ({\left (B a^{4} b - 3 \, {\left (A - C\right )} a^{3} b^{2} - 3 \, B a^{2} b^{3} + {\left (A - C\right )} a b^{4}\right )} c + {\left ({\left (A - C\right )} a^{4} b + 3 \, B a^{3} b^{2} - 3 \, {\left (A - C\right )} a^{2} b^{3} - B a b^{4}\right )} d\right )} \tan \left (f x + e\right )\right )} \log \left (\frac {b^{2} \tan \left (f x + e\right )^{2} + 2 \, a b \tan \left (f x + e\right ) + a^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) + 2 \, {\left (2 \, {\left ({\left ({\left (A - C\right )} a^{4} b + 3 \, B a^{3} b^{2} - 3 \, {\left (A - C\right )} a^{2} b^{3} - B a b^{4}\right )} c - {\left (B a^{4} b - 3 \, {\left (A - C\right )} a^{3} b^{2} - 3 \, B a^{2} b^{3} + {\left (A - C\right )} a b^{4}\right )} d\right )} f x + {\left (C a^{5} - 2 \, B a^{4} b + 3 \, {\left (A - C\right )} a^{3} b^{2} + 3 \, B a^{2} b^{3} - {\left (3 \, A - 2 \, C\right )} a b^{4} - B b^{5}\right )} c + {\left (B a^{5} - {\left (2 \, A - 3 \, C\right )} a^{4} b - 3 \, B a^{3} b^{2} + 3 \, {\left (A - C\right )} a^{2} b^{3} + 2 \, B a b^{4} - A b^{5}\right )} d\right )} \tan \left (f x + e\right )}{2 \, {\left ({\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} f \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{7} b + 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} + a b^{7}\right )} f \tan \left (f x + e\right ) + {\left (a^{8} + 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} + a^{2} b^{6}\right )} f\right )}} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 3.17, size = 1037, normalized size = 3.24 \[ \frac {\frac {2 \, {\left (A a^{3} c - C a^{3} c + 3 \, B a^{2} b c - 3 \, A a b^{2} c + 3 \, C a b^{2} c - B b^{3} c - B a^{3} d + 3 \, A a^{2} b d - 3 \, C a^{2} b d + 3 \, B a b^{2} d - A b^{3} d + C b^{3} d\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {{\left (B a^{3} c - 3 \, A a^{2} b c + 3 \, C a^{2} b c - 3 \, B a b^{2} c + A b^{3} c - C b^{3} c + A a^{3} d - C a^{3} d + 3 \, B a^{2} b d - 3 \, A a b^{2} d + 3 \, C a b^{2} d - B b^{3} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {2 \, {\left (B a^{3} b c - 3 \, A a^{2} b^{2} c + 3 \, C a^{2} b^{2} c - 3 \, B a b^{3} c + A b^{4} c - C b^{4} c + A a^{3} b d - C a^{3} b d + 3 \, B a^{2} b^{2} d - 3 \, A a b^{3} d + 3 \, C a b^{3} d - B b^{4} d\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} + \frac {3 \, B a^{3} b^{4} c \tan \left (f x + e\right )^{2} - 9 \, A a^{2} b^{5} c \tan \left (f x + e\right )^{2} + 9 \, C a^{2} b^{5} c \tan \left (f x + e\right )^{2} - 9 \, B a b^{6} c \tan \left (f x + e\right )^{2} + 3 \, A b^{7} c \tan \left (f x + e\right )^{2} - 3 \, C b^{7} c \tan \left (f x + e\right )^{2} + 3 \, A a^{3} b^{4} d \tan \left (f x + e\right )^{2} - 3 \, C a^{3} b^{4} d \tan \left (f x + e\right )^{2} + 9 \, B a^{2} b^{5} d \tan \left (f x + e\right )^{2} - 9 \, A a b^{6} d \tan \left (f x + e\right )^{2} + 9 \, C a b^{6} d \tan \left (f x + e\right )^{2} - 3 \, B b^{7} d \tan \left (f x + e\right )^{2} + 8 \, B a^{4} b^{3} c \tan \left (f x + e\right ) - 22 \, A a^{3} b^{4} c \tan \left (f x + e\right ) + 22 \, C a^{3} b^{4} c \tan \left (f x + e\right ) - 18 \, B a^{2} b^{5} c \tan \left (f x + e\right ) + 2 \, A a b^{6} c \tan \left (f x + e\right ) - 2 \, C a b^{6} c \tan \left (f x + e\right ) - 2 \, B b^{7} c \tan \left (f x + e\right ) - 2 \, C a^{6} b d \tan \left (f x + e\right ) + 8 \, A a^{4} b^{3} d \tan \left (f x + e\right ) - 14 \, C a^{4} b^{3} d \tan \left (f x + e\right ) + 22 \, B a^{3} b^{4} d \tan \left (f x + e\right ) - 18 \, A a^{2} b^{5} d \tan \left (f x + e\right ) + 12 \, C a^{2} b^{5} d \tan \left (f x + e\right ) - 2 \, B a b^{6} d \tan \left (f x + e\right ) - 2 \, A b^{7} d \tan \left (f x + e\right ) - C a^{6} b c + 6 \, B a^{5} b^{2} c - 14 \, A a^{4} b^{3} c + 11 \, C a^{4} b^{3} c - 7 \, B a^{3} b^{4} c - 3 \, A a^{2} b^{5} c - B a b^{6} c - A b^{7} c - C a^{7} d - B a^{6} b d + 6 \, A a^{5} b^{2} d - 9 \, C a^{5} b^{2} d + 11 \, B a^{4} b^{3} d - 7 \, A a^{3} b^{4} d + 4 \, C a^{3} b^{4} d - A a b^{6} d}{{\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} {\left (b \tan \left (f x + e\right ) + a\right )}^{2}}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.33, size = 1513, normalized size = 4.73 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.64, size = 574, normalized size = 1.79 \[ \frac {\frac {2 \, {\left ({\left ({\left (A - C\right )} a^{3} + 3 \, B a^{2} b - 3 \, {\left (A - C\right )} a b^{2} - B b^{3}\right )} c - {\left (B a^{3} - 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} + {\left (A - C\right )} b^{3}\right )} d\right )} {\left (f x + e\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {2 \, {\left ({\left (B a^{3} - 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} + {\left (A - C\right )} b^{3}\right )} c + {\left ({\left (A - C\right )} a^{3} + 3 \, B a^{2} b - 3 \, {\left (A - C\right )} a b^{2} - B b^{3}\right )} d\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {{\left ({\left (B a^{3} - 3 \, {\left (A - C\right )} a^{2} b - 3 \, B a b^{2} + {\left (A - C\right )} b^{3}\right )} c + {\left ({\left (A - C\right )} a^{3} + 3 \, B a^{2} b - 3 \, {\left (A - C\right )} a b^{2} - B b^{3}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {{\left (C a^{4} b - 3 \, B a^{3} b^{2} + {\left (5 \, A - 3 \, C\right )} a^{2} b^{3} + B a b^{4} + A b^{5}\right )} c + {\left (C a^{5} + B a^{4} b - {\left (3 \, A - 5 \, C\right )} a^{3} b^{2} - 3 \, B a^{2} b^{3} + A a b^{4}\right )} d - 2 \, {\left ({\left (B a^{2} b^{3} - 2 \, {\left (A - C\right )} a b^{4} - B b^{5}\right )} c - {\left (C a^{4} b - {\left (A - 3 \, C\right )} a^{2} b^{3} - 2 \, B a b^{4} + A b^{5}\right )} d\right )} \tan \left (f x + e\right )}{a^{6} b^{2} + 2 \, a^{4} b^{4} + a^{2} b^{6} + {\left (a^{4} b^{4} + 2 \, a^{2} b^{6} + b^{8}\right )} \tan \left (f x + e\right )^{2} + 2 \, {\left (a^{5} b^{3} + 2 \, a^{3} b^{5} + a b^{7}\right )} \tan \left (f x + e\right )}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 15.89, size = 502, normalized size = 1.57 \[ -\frac {\frac {A\,b^5\,c+C\,a^5\,d+A\,a\,b^4\,d+B\,a\,b^4\,c+B\,a^4\,b\,d+C\,a^4\,b\,c+5\,A\,a^2\,b^3\,c-3\,A\,a^3\,b^2\,d-3\,B\,a^3\,b^2\,c-3\,B\,a^2\,b^3\,d-3\,C\,a^2\,b^3\,c+5\,C\,a^3\,b^2\,d}{2\,b^2\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {\mathrm {tan}\left (e+f\,x\right )\,\left (A\,b^4\,d+B\,b^4\,c+C\,a^4\,d+2\,A\,a\,b^3\,c-2\,B\,a\,b^3\,d-2\,C\,a\,b^3\,c-A\,a^2\,b^2\,d-B\,a^2\,b^2\,c+3\,C\,a^2\,b^2\,d\right )}{b\,\left (a^4+2\,a^2\,b^2+b^4\right )}}{f\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (e+f\,x\right )+b^2\,{\mathrm {tan}\left (e+f\,x\right )}^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (B\,d+A\,d\,1{}\mathrm {i}+B\,c\,1{}\mathrm {i}-A\,c+C\,c-C\,d\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (A\,d+B\,c-C\,d-A\,c\,1{}\mathrm {i}+B\,d\,1{}\mathrm {i}+C\,c\,1{}\mathrm {i}\right )}{2\,f\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}-\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (\left (A\,d+B\,c-C\,d\right )\,a^3+\left (3\,B\,d-3\,A\,c+3\,C\,c\right )\,a^2\,b+\left (3\,C\,d-3\,B\,c-3\,A\,d\right )\,a\,b^2+\left (A\,c-B\,d-C\,c\right )\,b^3\right )}{f\,\left (a^6+3\,a^4\,b^2+3\,a^2\,b^4+b^6\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: AttributeError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________